<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="s_setup" :rules="rules" label-width="100px" id="mvcfm">
      <el-button @click="popAddAuthenticationType('')" type='success' size="mini"><i class='fa fa-plus'></i>增加</el-button>
      <div class="form-unit">
        <span class="mvc-title-left"> 体系类型 </span>
      </div>
      <el-table :data="s_setup">
        <el-table-column label="#" align="center" type='index'>
        </el-table-column>
        <el-table-column label="操作" align="center" width='100' type=''>
          <template slot-scope="scope">
            <el-dropdown trigger="click">
              <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                  <el-link @click="d_setup('&CMIDsetup_id='+scope.row.setup_id+'')">删除</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="popUpAuthenticationType('&CMIDsetup_id='+scope.row.setup_id+'')">修改</el-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
        <el-table-column label="认证名称" prop="setup_name">
        </el-table-column>
      </el-table>
    </el-form>
    <el-dialog :visible.sync="AddAuthenticationTypeVisible" append-to-body>
      <AddAuthenticationType v-if="AddAuthenticationTypeVisible" ref="AddAuthenticationType" :popparams="popparams"> </AddAuthenticationType>
    </el-dialog>
    <el-dialog :visible.sync="UpAuthenticationTypeVisible" append-to-body>
      <UpAuthenticationType v-if="UpAuthenticationTypeVisible" ref="UpAuthenticationType" :popparams="popparams"> </UpAuthenticationType>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import AddAuthenticationType from "@/views/mes/certificate/AddAuthenticationType";
  import UpAuthenticationType from "@/views/mes/certificate/UpAuthenticationType";
  export default {
    name: 'AuthenticationType',
    components: {
      AddAuthenticationType,
      UpAuthenticationType,
    },
    props: ['popparams'],
    data() {
      return {
        AddAuthenticationTypeVisible: false,
        AddAuthenticationTypeValue: null,
        AddAuthenticationTypeDesc: null,
        UpAuthenticationTypeVisible: false,
        UpAuthenticationTypeValue: null,
        UpAuthenticationTypeDesc: null,
        vueparams: this.getVUEParams(""),
        s_setup: [],
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/mes/certificate/CertificateAction/authenticationType?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      d_setup(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/mes/certificate/CertificateAction/d_setup?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      popAddAuthenticationType(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.AddAuthenticationTypeVisible = !this.AddAuthenticationTypeVisible;
      },
      popUpAuthenticationType(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.UpAuthenticationTypeVisible = !this.UpAuthenticationTypeVisible;
      },
    },
  }
</script>
